﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace BFlatCompile.Nodes
{
	public class Assignment : Executable
	{
		public char Op { get; private set; }
		public Expression Target { get; private set; }
		public Expression Amount { get; private set; }
		public Token Token { get; private set; }

		public Assignment(Expression targetExpression, Expression modifyValueBy, char op, Token token)
		{
			this.Target = targetExpression;
			this.Amount = modifyValueBy;
			this.Op = op;
			this.Token = token;
		}

		public override void ResolveCode(Class c, Dictionary<object, object> parents)
		{
			this.Target.ResolveCode(c, parents);
			this.Amount.ResolveCode(c, parents);
		}

		public override void ResolveClassToThis(Class c)
		{
			this.Target.ResolveClassToThis(c);
			this.Amount.ResolveClassToThis(c);
		}
	}
}
